#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <unordered_map>
using namespace std;

class Solution {
public:
    int getNum(int num)
    {
        int ret = 0;
        while (num)
        {
            int tmp = num % 10;
            ret += tmp * tmp;
            num /= 10;
        }
        return ret;
    }
    bool isHappy(int n) {
        int pre = getNum(n);
        int cur = getNum(n);
        do
        {
            cur = getNum(cur);
            pre = getNum(getNum(pre));
        } while (cur != pre);
        if (pre == 1)
            return true;
        else
            return false;
    }
};


int main()
{
	return 0;
}
